// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import vueRouter from 'vue-router';

Vue.config.productionTip = false;

//导入路由duix
import index from './components/index.vue';
import index_s from './components/index/index_s.vue';
import account from './components/index/account.vue';
import student from './components/index/student.vue';
import bottom from './components/index/bottom.vue';
import login from './components/login.vue';
import order_form from './components/order_form.vue';
import pay from './components/pay.vue';
import details from './components/details.vue';
import shopping from './components/shopping.vue';
import rename from './components/rename.vue';
import reset_passwords from './components/reset_passwords.vue';
import search_for_details from './components/search_for_details.vue';
//路由规则
var router1 = new vueRouter({
    routes:[
        {path:"/",redirect:'/login'},
        {path:"/index",component:index,
            children:[
                {path:'/account',component:account},//账号
                {path:'/index_s',component:index_s},//首页
                {path:"/student",component:student} //学习
            ],redirect:"/index_s"}, //主页面
        {path:"/bottom",component:bottom}, //底部组件
        {path:"/login",component:login}, //登录页面
        {path:"/order_form",component:order_form},//订单页面
        {path:"/pay",component:pay},// 支付页面
        {path:"/details/:id",component:details},// 商品详情页面
        {path:"/shopping",component:shopping},// 购物车页面
        {path:"/rename",component:rename},// 修改密码
        {path:"/reset_passwords",component:reset_passwords},// 修改密码
        {path:"/search_for_details",component:search_for_details}// 搜索详情
    ]
});


// 将vue-resource在vue中帮定，自动在vue对象实例上注入一个￥http对象就可以使用ajax对象了
import vueResource from 'vue-resource';
Vue.use(vueResource);
//注册mui的CSS样式
import '../static/mui/css/mui.css';

//导入mint-ui的css文件
import 'mint-ui/lib/style.min.css';
//导入mint-ui组件1对象
import mintui from 'mint-ui';
//在vue全局中使用mintui
Vue.use(mintui);

//导入 axios 因为每个组件都有自己的作用域，所以需要把axios添加到vue的原型当中，就可以在所有组件中使用
import axios from 'axios'
Vue.prototype.$ajax = axios;


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router:router1,
  components: { App },
  template: '<App/>'
});
